<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class LogListItem extends Migration
{
    protected $_table = 'log_list_item';
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create($this->_table, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->integer('item_id')->default(0)->unsigned();

            $table->dateTime('completed_at')->nullable();
            $table->dateTime('created_at')->nullable();
            $table->dateTime('updated_at')->nullable();
            //$table->dateTime('deleted_at')->nullable();

            $table->index('item_id');
        });

        DB::statement("ALTER TABLE `{$this->_table}` comment '清单操作记录表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        if(config('app.env') == 'development'){
            Schema::dropIfExists($this->_table);
        }
    }
}
